//
//  MypatientCell.m
//  HandheldHospital
//
//  Created by zhangchao on 16/3/8.
//  Copyright © 2016年 zhangchao. All rights reserved.
//

#import "MypatientCell.h"
#import <Masonry.h>

#define kWidth self.contentView.frame.size.width

@implementation MypatientCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self addViews];
    }
    return  self;
}

- (void)addViews
{
    self.imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageV];
    self.imageV.layer.masksToBounds = YES;
    self.imageV.layer.cornerRadius = kWidth * 0.075;
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView).offset(kWidth * 0.1);
        make.size.mas_equalTo(CGSizeMake(kWidth * 0.15, kWidth * 0.15));
    }];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView).offset(kWidth * 0.3);
        make.size.mas_equalTo(CGSizeMake(kWidth * 0.65, 30));
    }];
}


+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"Cell";
    MypatientCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[MypatientCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
